<template>
  <div>
    <div ref="main" class="main">图表</div>
  </div>
</template>

<script>
import * as echarts from 'echarts'
import chinaJson from './data/中华人民共和国.json'
// 1.注册地图  或者用axios直接导入
echarts.registerMap('china', { geoJSON: chinaJson })
export default {
  data() {
    return {
      chart: null
    }
  },
  mounted() {
    // this.$msg('我是msg')
    this.chart = echarts.init(this.$refs.main)
    // 2.使用geo配置地图
    this.chart.setOption({
      geo: [{
        map: 'china'
      }]
    })
  },

  methods: {

  }
}
</script>

<style>
.main{
    width: 500px;
    height: 500px;
}
</style>
